Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting multiple block styles. #21714

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

richrd
Copy link

@richrd richrd commented Apr 19, 2020

Description

This PR allows setting multiple active block styles for a block. Closes #14598 .
To better distinguish between active and inactive styles I added a check mark to the top right corner of the style preview (see screenshot). A similar check mark can be seen in the media library when selecting images.

How has this been tested?

Tested with a fresh wp-env environment. Made sure that setting multiple styles work in the Gutenberg editor and that they are correctly rendered on front end. Passes the entire test suite.

Screenshots

image

Types of changes

This changes the behavior of block styles so that multiple can be active at once. This doesn't break using just a single style and if no styles are selected the default style is still enforced. However since multiple styles can be selected, the user interaction changes a bit: choosing a style no longer disables the previous selected style.

One thing to consider is that this makes it possible to activate styles that conflict with each other. Most of the time it's probably obvious like setting multiple styles that affect background or border, but maybe not in all cases. Unfortunately I can't see any bulletproof solution to this as discussed here #14598 .

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@richrd richrd force-pushed the multiple-block-styles branch from 83cb283 to a2db390 Compare April 19, 2020 14:41
@richrd richrd marked this pull request as ready for review April 19, 2020 15:08
Base automatically changed from master to trunk March 1, 2021 15:43
@annezazu annezazu added the [Feature] Theme Style Variations Related to style variations provided by block themes label Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Theme Style Variations Related to style variations provided by block themes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blocks: Allow users to select multiple block style variations
2 participants